import java.util.*;
/**
 * Created with Intellij JDEA
 * Description:
 * User:
 * Date:2022-06-21
 * Time:10:10
 */
public class 单词倒排 {
    public static String fun(String s) {
        char[] str = s.toCharArray();
        for (int i = 0; i < str.length; i++) {
            if (str[i] >= 'a' && str[i] <= 'z' || str[i] >= 'A' && str[i] <= 'Z') {
                continue;
            } else {
                str[i] = ' ';
            }
        }
        s = new String(str);
        return s;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String str = in.nextLine();
            str = fun(str);
            String[] arr = str.trim().split(" ");
            StringBuffer sb = new StringBuffer();
            for (int i = arr.length - 1; i >= 0; i--) {
                sb.append(arr[i] + " ");
            }
            System.out.println(sb.toString().trim());
        }
    }
}
